package com.cq.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cq.ssm.mapper.NationMapper;
import com.cq.ssm.po.Nation;
import com.cq.ssm.service.NationService;

@Component("nationService")
public class NationServiceImpl implements NationService {

	@Autowired
	private NationMapper nm;
	// 插入一条记录
	public boolean insertNation(Nation nation) throws Exception {
		int i = nm.insertSelective(nation);
		return i==1?true:false;
	}

	// 根据id删除一条记录
	public boolean deleteById(Integer id) throws Exception {
		int i = nm.deleteByPrimaryKey(id);
		return i==1?true:false;
	}

	// 查询所有记录
	public List<Nation> findAll() throws Exception {
		return nm.selectAllNation();
	}
}
